home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / Samples / SampleCode / Plug-in - WireFrame Renderer / SR_WinDialog.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-14  |  3.4 KB  |  136 lines  |  [TEXT/LMAN]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        SR_WinDialog.c                                             **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:     Modal dialog routines                                      **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1996-1997 Apple Computer, Inc.  All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #include "QD3D.h"
  15. #include "QD3DExtension.h"
  16.  
  17. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  18.  
  19. #include "SR.h"
  20. #include "SR_WinDialog.h"
  21. #include "resource.h"
  22.  
  23. /******************************************************************************
  24.  **                                                                             **
  25.  **                            Globals and Externs                                 **
  26.  **                                                                             **
  27.  *****************************************************************************/
  28.  
  29. extern HINSTANCE    hinstMyDLL;
  30.  
  31. static TSRPrivate    *SRgRendererPrivate = NULL;
  32.  
  33.  
  34. /******************************************************************************
  35.  **                                                                             **
  36.  **                            Forward Declarations                             **
  37.  **                                                                             **
  38.  *****************************************************************************/
  39.  
  40. staticBOOL CALLBACK SR_ModalConfigure(
  41.     HWND        hDlg,
  42.     UINT        iMsg,
  43.     WPARAM        wParam,
  44.     LPARAM        lParam);
  45.     
  46.  
  47. /******************************************************************************
  48.  **                                                                             **
  49.  **                                Dialog Routines                                 **
  50.  **                                                                             **
  51.  *****************************************************************************/
  52.  
  53. /*===========================================================================*\
  54.  *
  55.  *    Routine:    SR_WinModalDialog()
  56.  *
  57.  *    Comments:    
  58.  *
  59. \*===========================================================================*/
  60.  
  61. TQ3Status SR_WinModalDialog(
  62.     TQ3RendererObject            renderer,
  63.     TQ3DialogAnchor             dialogAnchor, 
  64.     TQ3Boolean                    *canceled,    
  65.     void                        *rendererPrivate)
  66. {
  67.     TQ3Status    status = kQ3Success;
  68.     BOOL        wasChanged;
  69.  
  70.     SRgRendererPrivate = rendererPrivate;
  71.  
  72.     if ((wasChanged = DialogBox(hinstMyDLL,
  73.         MAKEINTRESOURCE(IDD_MODAL_CONFIGURE),
  74.         dialogAnchor.ownerWindow, SR_ModalConfigure)) != -1) {
  75.         *canceled = !wasChanged;
  76.         status = kQ3Success;
  77.     } else {
  78.         *canceled = kQ3True;
  79.         status = kQ3Failure;
  80.     }
  81.     
  82.     SRgRendererPrivate = NULL;            
  83.     return (status);
  84. }
  85.  
  86.  
  87. /*===========================================================================*\
  88.  *
  89.  *    Routine:    SR_ModalConfigure()
  90.  *
  91.  *    Comments:    
  92.  *
  93. \*===========================================================================*/
  94.  
  95. static BOOL CALLBACK SR_ModalConfigure(
  96.     HWND    hDlg,
  97.     UINT    iMsg,
  98.     WPARAM    wParam,
  99.     LPARAM    lParam)
  100. {
  101.     short    checkBoxValue;
  102.     
  103.     switch (iMsg) {
  104.         case WM_INITDIALOG:
  105.             checkBoxValue = SRgRendererPrivate->dummyConfigData;
  106.             if (checkBoxValue) {
  107.                 CheckDlgButton(hDlg, IDC_DUMMYCONFIG, BST_CHECKED);
  108.             } else {
  109.                 CheckDlgButton(hDlg, IDC_DUMMYCONFIG, BST_UNCHECKED);
  110.             }
  111.             
  112.             return (TRUE);
  113.         case WM_COMMAND:
  114.             switch (LOWORD(wParam)) {
  115.                 case IDOK:
  116.                     if (IsDlgButtonChecked(hDlg, IDC_DUMMYCONFIG)) {
  117.                         SRgRendererPrivate->dummyConfigData = kQ3True;
  118.                     } else {
  119.                         SRgRendererPrivate->dummyConfigData = kQ3False;
  120.                     }
  121.                     EndDialog(hDlg, TRUE);
  122.                     
  123.                     return (TRUE);
  124.  
  125.                 case IDCANCEL:
  126.                     EndDialog(hDlg, FALSE);
  127.                     
  128.                     return (TRUE);
  129.             }
  130.     }
  131.  
  132.     return (FALSE);            
  133. }
  134.  
  135. #endif  /*  WINDOW_SYSTEM_WIN32  */
  136.